package cn.itcast.bos.service.system.Imp;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.itcast.bos.dao.system.MenuDao;
import cn.itcast.bos.domain.system.Menu;
import cn.itcast.bos.domain.system.User;
import cn.itcast.bos.service.system.MenuService;

@Service
@Transactional
public class MenuServiceImp implements MenuService {

	@Autowired
	private MenuDao menuDao;

	@Override
	public List<Menu> findAll() {
		return menuDao.findAll();
	}

	@Override
	public List<Menu> findByparentMenu() {

		return menuDao.findByparentMenu(null);
	}

	@Override
	public void save(Menu model) {
		// TODO Auto-generated method stub
		menuDao.save(model);
	}

	@Override
	public List<Menu> findByUser(User user) {
		return menuDao.findByUser(user.getId());
	}

}
